﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.IO;

namespace MyNineteenthWPFDemo
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {

        }

        //重写
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            base.OnSessionEnding(e);
            e.Cancel = true;
            MessageBox.Show("无法注销或关闭系统");
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindow win = new MainWindow();
            if(e.Args.Length > 0)
            {
                string file = e.Args[0];//文件名
                if (File.Exists(file))
                    win.LoadFile(file);
            }
            win.Show();
        }

        private List<Window2> document = new List<Window2>();
        public List<Window2> Documents
        {
            get { return document; }
            set { document = value; }
        }
    }
}
